#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 505;
const int MOD = 998244353;

int n, m;
ll fac[N], ifac[N];
ll fastpow(ll b, ll p) {
  ll res = 1;
  while (p) {
    if (p & 1) res = res * b % MOD;
    b = b * b % MOD;
    p >>= 1;
  }
  return res;
}
ll p[N][N * N];
void init_p() {
  rep(i, 0, 500) {
    p[i][0] = 1;
    rep(j, 1, 500 * 500 / 2) p[i][j] = p[i][j - 1] * i % MOD;
  }
}
void init_fac(ll n) {
  fac[0] = 1, ifac[0] = 1;
  rep(i, 1, n) fac[i] = fac[i - 1] * i % MOD;
  ifac[n] = fastpow(fac[n], MOD - 2);
  per(i, n - 1, 1) ifac[i] = ifac[i + 1] * (i + 1) % MOD;
}
ll cmb(ll n, ll m) {
  if (n < 0 || m < 0 || m > n) return 0;
  return fac[n] * ifac[m] % MOD * ifac[n - m] % MOD;
}
ll c2(ll n) { return n * (n - 1) / 2; }
ll f[N];
void init_f(ll k) {
  f[1] = 1;
  rep(i, 2, n) {
    f[i] = p[m][c2(i)];
    rep(j, 1, i - 1) {
      ll x = cmb(i - 1, j - 1) * f[j] % MOD;
      ll y = p[m - k][j * (i - j)];
      ll z = p[m][c2(i - j)];
      f[i] = (f[i] - x * y % MOD * z % MOD + MOD) % MOD;
    }
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  init_fac(500);
  init_p();
  cin >> n >> m;
  ll ans = 0;
  rep(k, 0, m - 1) {
    init_f(k);
    ll now = 0;
    rep(sz, 1, n) {
      ll x = cmb(n, sz) * f[sz] % MOD;
      ll y = p[m - k][sz * (n - sz)];
      ll z = p[m][c2(n - sz)];
      now = (now + x * y % MOD * z % MOD) % MOD;
    }
    ans = (ans + now) % MOD;
  }
  ans = (ans - p[m][c2(n)] * m % MOD + MOD) % MOD;
  cout << ans;
  return 0;
}